package com.ashin.repository;

import com.ashin.entity.MovieEntity;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author Ashin
 */
public interface MovieRepository extends Neo4jRepository<MovieEntity, String> {

    MovieEntity findOneByTitle(String title);

    @Query("match p=(m:Movie)<-[]-() return p")
    List<MovieEntity> all();


    @Query("MATCH (nineties:Movie) WHERE nineties.released >= $startR AND nineties.released < $endR RETURN nineties.title")
    List<String> findTitle(@Param("startR") Integer startRelease, @Param("endR") Integer endRelease);



}
